<%--
 *  File:    StandardManagementEdit
 *  @Author: jackwang 
 *  Date:    2013/9/9
 *
 *  Copyright (C) 2000 - 2010 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<% //--------------------------------------  setting logger --%>
<%
  	Category cat = Category.getInstance("jsp.StandardManagementEdit");    
%>

<% //--------------------------------------  variant and initialization --%>
<%
  	String strModuleName = "COM";
  	String privilegeCode = "A01009";
    String contextPath = request.getContextPath();
%>

<% //--------------------------------------  include files list --%>
<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/PageDefault.inc" %>

<html>
<head>
<title>ProductGroupEdit</title>
<PageFlow:CheckPageFlow pageName="p_opencontroledit"/>  
<%@ include file="/inc/CatchError.inc" %>
<%@ include file="/inc/InitEdit.inc" %>

<% //--------------------------------------  output variant from pageflow --%>
<%
	boolean readOnly = false;
	HashMap productGroup = (HashMap)pageContext.getAttribute("productgroup");
	if(productGroup == null) productGroup = new HashMap();
	Integer OpenControlId = (Integer)productGroup.get("opencontrolid");
	if(null != OpenControlId) readOnly = true;
%>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%= contextPath%>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%= contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript">
function page_done()
{ 
  	if(!checkForm(document.cform)) return;
  	emptyToNull(document.cform);
  	document.cform.actionname.value = "done";
  	isRunning = true;
  	cform.target = "_parent";
  	document.cform.submit();
}
function popWindowsGroupSuit(){
	if ((cform.opencontrolid.value==null)||(cform.opencontrolid.value.length <= 0)||(cform.opencontrolid.value=="null"))
	{
    	alert("<%=message.getMessageDesc("SAVE_INFO_FIRST")%>");
        return;
    }
	var opencontrolid = cform.opencontrolid.value;
	var url = "";
	if (cform.status.value==41){
     url = "StandardManagementUnitEdit.jsp?"+"<%= OvalTools.randomURL() %>"+"&opencontrolid="+opencontrolid+"&isview="+"2";
     }
   else {
     url = "StandardManagementUnitEdit.jsp?"+"<%= OvalTools.randomURL() %>"+"&opencontrolid="+opencontrolid+"&isview="+"1";
    }
	var windowAttribute = "height=400, width=600,top=100,left=100, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=yes";
	if(popwindow!=null) popwindow.close();
 	popwindow = window.open(url,null,windowAttribute);
}
function popContactProd(){
    if(popwindow!=null) popwindow.close();
 	popwindow = window.open("<%=contextPath%>/masterdata/ogm/ProductbrandPopWindow.jsp?<%= OvalTools.randomURL() %>", "newwindow", "height=400, width=600,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=yes")
}
 function set_orgNameByPopWindow(id,code,name){
    document.cform.productgroupid.value =id;
    document.cform.productgroupname.value= name;
}
 function productgroup_clear(){
    document.cform.productgroupid.value ="";
    document.cform.productgroupname.value="";
}
function set_orgNameByPopWindow(id,code,name){
	document.cform.productgroupname.value=name;
	document.cform.productgroupid.value=id;
}
function popPrdGroup(){
	if(popwindow!=null) popwindow.close();
 	var opentype=document.cform.opentype.value;
 	var deptid=document.cform.deptid.value;
 	if(isEmpty(deptid)){
 	  alert("请先选择部门！");
 	  return;
 	}
 	if(isEmpty(opentype)){
 	  alert("请先选择开户类型！");
 	  return;
 	}
 	if(opentype==1){
      url = "<%=contextPath%>/masterdata/upm/ProductbrandPopWindow.jsp?<%= OvalTools.randomURL() %>&datacategory=7"+"&zyldeptid="+deptid;
    }
    if(opentype==2){
      url = "<%=contextPath%>/masterdata/upm/ProductbrandPopWindow.jsp?<%= OvalTools.randomURL() %>&datacategory=8"+"&zyldeptid="+deptid;
    }
    if(opentype==3){
      url = "<%=contextPath%>/masterdata/upm/ProductbrandPopWindow.jsp?<%= OvalTools.randomURL() %>&datacategory=14"+"&zyldeptid="+deptid;
    }
    attribute = "height=400, width=600,top=120,left=120,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=yes";
	popwindow = window.open(url,"newwindow", attribute);
}
</script>
</head>

<body>
	
	<% //--------------------------------------  hidden form variant --%>
	<form name="cform" method="post" action="<%= contextPath%>/Dispatcher" target="_parent">	
    <input type="hidden" name="pagename" value="p_opencontroledit">
    <input type="hidden" name="actionname">
    <input type="hidden" name="viewflag">
    <custom:hidden property="opencontrolid" name="productgroup"/>
	<table width="100%" cellspacing="0" border="0" cellpadding="0">
  	<tr> 
    	<td> 
      		<table width="100%" cellspacing="0" cellpadding="0">
        	<tr> 
          		<td colspan="2" class="summary_top"></td>
        	</tr>
        	<tr> 
          		<td colspan="2"><img src="<%= contextPath%>/images/<%= strLanguageCode %>/quote.gif" width="16" height="11"> 
            	<%= label.getLabelName("L_NEOpenCtl") + label.getLabelName("L_Colon") %></td>
        	</tr>
      		</table>
      		
      		<table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="left">
        	<tr> 
          		<td class="need" width="15%"><%= label.getLabelName("L_Dept") + label.getLabelName("L_Colon") %></td>
            	<td class="title_left" width="35%"><custom:select name="productgroup" command="notnull" optionsName="alldeptnames" optionValueKey="deptid" optionInnerTextKey="deptname"	property="deptid"  defaultValue="----" defaultValueCost=" " label="L_Dept" onchange="productgroup_clear()"/></td>
          		</td>
          		<td class="need" width="15%"><%= label.getLabelName("L_OpenType") + label.getLabelName("L_Colon") %> </td>
          		<td width="35%">
          			<custom:selectdic dictType="DicrelationType" property="opentype" name="productgroup" command="notnull" label="L_OpenType" defaultValue="----" defaultValueCost=" " onchange="productgroup_clear()"/>
          		</td>
        	</tr>
        	<tr> 
        	    <td class="need"><%= label.getLabelName("L_AddUpYear") + label.getLabelName("L_Colon") %></td>
          		<td class="title_left">
            		<custom:selectdic dictType="Years" property="addupyear" name="productgroup" command="notnull" label="L_AddUpYear" defaultValue="----" defaultValueCost=" " sortOrder="desc" />
          		</td>
                <td class="need" ><%= label.getLabelName("L_AddUpMonth") + label.getLabelName("L_Colon") %></td>
          		<td class="title_left"> 
          			<custom:selectdic dictType="Months" property="addupmonth" name="productgroup" command="notnull" label="L_AddUpMonth" defaultValue="--" defaultValueCost=" " />
          		</td>
          		<!-- 
          		<td class="need" height="13" ><%= label.getLabelName("L_Product") + label.getLabelName("L_Colon") %></td>
          		<td><a onclick='popWindowsGroupSuit()'> <custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0" /></a></td>
          		 -->
        	</tr>
        	<tr> 
        	    <td class="need"><%= label.getLabelName("L_Status") + label.getLabelName("L_Colon") %></td>
          		<td class="title_left">
            		<custom:selectdic dictType="Status" property="status" name="productgroup" command="notnull" label="L_Status" valueCriteria="41,28" sortOrder="desc" />
          		</td>
          		<td class="need" ><%= label.getLabelName("L_Variety") + label.getLabelName("L_Colon") %></td>
          		<td>
          		 <custom:text property="productgroupname" size="15"  name="productgroup"></custom:text>
			     <a onclick="popPrdGroup();"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0" /></a>
			     <custom:hidden  property="productgroupid" command="notnull" label="L_Variety" name="productgroup"/>
          		</td>
        	</tr>
            <tr> 
          		<td class="need" ><%= label.getLabelName("L_ConditionEntry") + label.getLabelName("L_Colon") %></td>
          		<td><a onclick="popWindowsGroupSuit()"><custom:button type="2" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a></td>
          		<!-- 
                <td class="need" ><%= label.getLabelName("L_UOM1") + label.getLabelName("L_Colon") %></td>
          		<td> 
          			<custom:selectdic dictType="UomType" property="unit" name="productgroup" command="notnull" label="L_OpenType" defaultValue="----" defaultValueCost=" " valueCriteria="1,4,5,6"/>
          		</td>
          		<td class="need" height="13" ><%= label.getLabelName("L_Product") + label.getLabelName("L_Colon") %></td>
          		<td><a onclick='popWindowsGroupSuit()'> <custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0" /></a></td>
          		 -->
        	</tr>
        	<!-- 
        	<tr> 
          		<td class="need" width="110"><%= label.getLabelName("L_AddUpQty") + label.getLabelName("L_Colon") %></td>
          		<td> 
          			<custom:text property="qty"  name="productgroup"  command="notnull,positive" label="L_AddUpQty" size="20"/>
          		</td>
          		<td class="need" ><%= label.getLabelName("L_AddUpMonths") + label.getLabelName("L_Colon") %> </td>
          		<td>
          		<custom:text property="addupmonths"  name="productgroup"  command="notnull,positive" label="L_AddUpMonths" size="20"/>
          		</td>
        	</tr>
        	 -->
        	</table>
    	</td>
  	</tr>
  	<tr> 
    	<td class="summary_top"></td>
  	</tr>
  	<tr> 
    	<td class="td_center"><a onclick="page_done()"><custom:button type="1" label="L_Finish" imgsrc="finish.gif" border="0" style="width:60"/></a></td>
  	</tr>
	</table>
</form>
</body>
</html>


